package br.com.jr.arq.dao;

import java.util.List;

import javax.inject.Inject;

import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.stereotype.Repository;

import br.com.jr.arq.dominio.Usuario;

@Repository
public class UserDao  {

	@Inject
	protected HibernateTemplate ht;
	
	@SuppressWarnings("unchecked")
	public Usuario getUserByUserName(String userName) {
		try {
			List<Usuario> usuarios = ht.find("from Usuario where username = ? ", userName);
			return usuarios.get(0);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}
	
}